<style>
  #main{text-align:left;width:800px;margin:auto;height:auto;margin-top:100px;}
  .logged{font-size:20px;line-height:40px;float:left;width:380px;}
  .catalog{float:left;width:400px;line-height:40px;font-size:20px;margin-left:20px;}	
</style>



<div id="main">

<div  class="logged">
	<?
	if($global_user != null){
	?>
	<div>
		Welcome, <?=$global_user['uname']?><br/>
		<a href="<?echo Yii::app()->request->baseUrl."/?r=card/logout"?>">Logout</a>
	</div>
	<?
	}else{
	?>
	<div class="form">
	<?php $form=$this->beginWidget('CActiveForm', array(
		'id'=>'login-form',
		'enableClientValidation'=>true,
		'clientOptions'=>array(
			'validateOnSubmit'=>true,
		),
	)); ?>
		<fieldset>
		<legend>Login</legend>
		<div class="row">
			<?php echo $form->labelEx($model,'username'); ?>
			<?php echo $form->textField($model,'username'); ?>
			<?php echo $form->error($model,'username'); ?>
		</div>
	
		<div class="row">
			<?php echo $form->labelEx($model,'password'); ?>
			<?php echo $form->passwordField($model,'password'); ?>
			<?php echo $form->error($model,'password'); ?>
		</div>
	
		<div class="row rememberMe">
			<?php echo $form->checkBox($model,'rememberMe'); ?>
			<?php echo $form->label($model,'rememberMe'); ?>
			<?php echo $form->error($model,'rememberMe'); ?>
		</div>
	
		<div class="row buttons">
			<?php echo CHtml::submitButton('Login'); ?>
		</div>
	
	<?php $this->endWidget(); ?>
	</div><!-- form -->
	
	<div class="form">
	<?php $reg_form=$this->beginWidget('CActiveForm', array(
		'id'=>'reg-form',
		'enableClientValidation'=>true,
		'clientOptions'=>array(
			'validateOnSubmit'=>true,
		),
	)); ?>
		<fieldset>
		<legend>Regist</legend>

		<div class="row">
			<?php echo $reg_form->labelEx($reg_model,'email'); ?>
			<?php echo $reg_form->textField($reg_model,'email'); ?>
			<?php echo $reg_form->error($reg_model,'email'); ?>
		</div>
		
		<div class="row">
			<?php echo $reg_form->labelEx($reg_model,'username'); ?>
			<?php echo $reg_form->textField($reg_model,'username'); ?>
			<?php echo $reg_form->error($reg_model,'username'); ?>
		</div>
		
		<div class="row">
			<?php echo $reg_form->labelEx($reg_model,'password'); ?>
			<?php echo $reg_form->passwordField($reg_model,'password'); ?>
			<?php echo $reg_form->error($reg_model,'password'); ?>
		</div>
	
		<div class="row">
			<?php echo $reg_form->labelEx($reg_model,'confirmpassword'); ?>
			<?php echo $reg_form->passwordField($reg_model,'confirmpassword'); ?>
			<?php echo $reg_form->error($reg_model,'confirmpassword'); ?>
		</div>
	
		<div class="row buttons">
			<?php echo CHtml::submitButton('Regist'); ?>
		</div>
				
		</fieldset>
	<?php $this->endWidget(); ?>
	</div><!-- form -->
	
	<?
	}
	?>
</div>


<div class="catalog">
<b>Choose a catalog and learn:</b><br/>
<?
	if(count($catalog)>0){
		foreach($catalog as $c){
			echo "<a href='".Yii::app()->request->baseUrl.'/index.php?r=card/learn/&catalog='.$c['cid']."'>".$c['cataname']."</a>";
			echo "<br/>";
		}
	}else{
		echo "No catalog found!";
	}
?>
</div>

	
	
</div>